package com.llmcu.source.javase.colection.queue;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;

/**
 * 通过LinkedList感受队列
 *
 * @author liuling
 * @date 2024/12/2 19:32
 */
public class TestQuee {
    public static void main(String[] args) {
        Queue<Integer> queue = new LinkedList<>();
        System.out.println("--------------连续offer，往队列中放入一定量数据------------------");
        queue.offer(4);
        queue.offer(3);
        queue.offer(3);
        System.out.println("--------------一直peek，只能看到最先放入的值------------------");
        for (int i = 0; i < 4; i++) {
            System.out.println(queue.peek());
        }
        System.out.println("--------------一直poll，超过个数返回null------------------");
        for (int i = 0; i < 4; i++) {
            System.out.println(queue.poll());
        }
    }
}
